import axios from '@/libs/api.request'
import qs from 'qs'
import Cookies from 'js-cookie'

/**************************
  * 溯源码打印信息接口
 **************************/

//创建仓单质押信息接口
export const createRedDates = (data) => {
  console.log("创建溯源打印接收数据：", data)
  return axios.request({
    url: 'traceCode/',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改仓单质押信息接口

export const updateRedDates = (data) => {
  console.log("修改溯源打印接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  } else {
    reqParam = data.Id
  }
  return axios.request({
    url: 'traceCode/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}

//获取分页用户列表请求接口
export const getAllRedDates = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'traceCode/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//按条件查询溯源列表请求接口
export const searchRedDates = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""
  // //模糊查询处理
  // if (data.searchKy != "" && data.searchVal != "") {
  //   if (data.searchKy == "Age") {
  //     reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
  //   }else if(data.searchKy == "Sex"){
  //     if(data.searchVal == "男"){
  //       reqParam = "?" + "query=" + data.searchKy + ":" + "0"
  //     }else if(data.searchVal == "女"){
  //       reqParam = "?" + "query=" + data.searchKy + ":" + "1"
  //     }
  //   }else{
  //     reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
  //   }
  // }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'traceCode/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}
//获取单个溯源信息接口
export const getOneRedDates = ({ userId }) => {
  const data = {
    userId
  }
  console.log("获得传参：", userId)
  return axios.request({
    url: 'traceCode/' + userId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}
/**************************
 * 用户信息接口
 **************************/

//创建用户信息接口
export const createUserData = (data) => {
  console.log("创建用户接收数据：", data)
  return axios.request({
    url: 'user/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}
//删除用户信息
export const deleteUser = (data) => {
  return axios.request({
    // url: 'user/delete',
    url: 'user/' + data.id,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'Delete'
  })
}
//修改用户信息接口
export const updateUserData = (data) => {
  console.log("修改用户接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'user/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页用户列表请求接口
export const getAllUsers = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'user/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//按条件用户列表请求接口
export const searchUserData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'user/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//获取单个用户信息接口
export const getOneUser = ({ userId }) => {
  const data = {
    userId
  }
  console.log("获得传参：", userId)
  return axios.request({
    url: 'user/' + userId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//获取公司信息列表接口
export const getCompanyList = (data) => {
  console.log("获得公司信息传参：", data)
  //初始化请求参数
  var reqParam = ""
  //按字段查询处理
  if (data != null) {
    if (data.fields != "") {
      reqParam = "?" + "fields=" + data.fields
    }//else{
    //   reqParam = "?" + "fields=" + data.fields
    // }
    //判断上级是否存在
    if (reqParam != "") {
      reqParam = reqParam + "&"
    }
    //读取数量处理
    if (data.offset != "" && data.limit != "") {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + data.offset + "&limit=" + data.limit
    }
  }
  return axios.request({
    url: 'company/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取部门信息列表接口
export const getDeptList = (data) => {
  console.log("获得部门信息传参：", data)
  //初始化请求参数
  var reqParam = ""
  //按字段查询处理
  if (data != null) {
    if (data.fields != "") {
      reqParam = "?" + "fields=" + data.fields
    }
  }
  //判断上级是否存在
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }
  //读取数量处理
  if (data.offset != "" && data.limit != "") {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + data.offset + "&limit=" + data.limit
  }

  return axios.request({
    url: 'dept/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}
/**************************
 * 公司信息接口
 **************************/
//创建公司信息接口
export const createCompanyData = (data) => {
  console.log("创建公司接收数据：", data)
  return axios.request({
    url: 'company/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}
//删除用户信息
export const DeleteCompany = (data) => {
  return axios.request({
    url: 'company/' + data.id,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'Delete'
  })
}
//修改公司信息接口
export const updateCompanyData = (data) => {
  console.log("修改公司接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'company/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页公司列表请求接口
export const getAllCompanys = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'company/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件公司列表请求接口
export const searchCompanyData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'company/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个公司信息接口
export const getOneCompany = ({ companyId }) => {
  const data = {
    companyId
  }
  console.log("获得传参：", companyId)
  return axios.request({
    url: 'company/' + companyId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


/**************************
 * 部门信息接口
 **************************/
//创建部门信息接口
export const createDeptData = (data) => {
  console.log("创建部门接收数据：", data)
  return axios.request({
    url: 'dept/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改部门信息接口
export const updateDeptData = (data) => {
  console.log("修改部门接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'dept/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页部门列表请求接口
export const getAllDepts = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'dept/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件部门列表请求接口
export const searchDeptData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'dept/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个部门信息接口
export const getOneDept = ({ deptId }) => {
  const data = {
    deptId
  }
  console.log("获得传参：", deptId)
  return axios.request({
    url: 'dept/' + deptId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

/**************************
 * 价格管理信息接口
 **************************/



//创建价格信息接口
export const createCurrentPriceData = (data) => {
  console.log("创建价格接收数据：", data)
  return axios.request({
    url: 'currentPrice/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改价格信息接口
export const updateCurrentPriceData = (data) => {
  console.log("修改价格接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'currentPrice/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页价格列表请求接口
export const getAllCurrentPrices = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'currentPrice/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件价格列表请求接口
export const searchCurrentPriceData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'currentPrice/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个价格信息接口
export const getOneCurrentPrice = ({ currentPriceId }) => {
  const data = {
    currentPriceId
  }
  console.log("获得传参：", currentPriceId)
  return axios.request({
    url: 'currentPrice/' + currentPriceId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

/**************************
 * 历史价格信息接口
 **************************/
//创建历史价格信息接口
export const createHisPriceData = (data) => {
  console.log("创建历史价格接收数据：", data)
  return axios.request({
    url: 'hisPrice/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改历史价格信息接口
export const updateHisPriceData = (data) => {
  console.log("修改历史价格接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'hisPrice/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页历史价格列表请求接口
export const getAllHisPrices = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'hisPrice/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件历史价格列表请求接口
export const searchHisPriceData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'hisPrice/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个历史价格信息接口
export const getOneHisPrice = ({ hisPriceId }) => {
  const data = {
    hisPriceId
  }
  console.log("获得传参：", hisPriceId)
  return axios.request({
    url: 'hisPrice/' + hisPriceId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}



/**************************
 * 入库订单信息接口
 **************************/
//创建入库订单信息接口
export const createEntryOrderData = (data) => {
  console.log("创建入库订单接收数据：", data)
  return axios.request({
    url: 'entryOrders/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改入库订单信息接口
export const updateEntryOrderData = (data) => {
  console.log("修改入库订单接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'entryOrders/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页入库订单列表请求接口
export const getAllEntryOrders = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }

    if (data.step == 1) { //申请页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.exact:0"
    }

    if (data.step == 2) { //过磅页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.gte:1,status.lte:4"
    }

    if (data.step == 3) { //检验页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.exact:2"
    }

    if (data.step == 4) { //入库页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.exact:3"
    }

    if (data.step == 5) { //签约页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.exact:5"
    }

    if (data.step == 6) { //结算页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.exact:6"
    }

    if (data.step == 7) { //汇总页面
      if (reqParam == "") {
        reqParam = "?"
      } else {
        reqParam = reqParam + "&"
      }
      reqParam = reqParam + "query=" + "status.exact:7"
    }

  }

  return axios.request({
    url: 'entryOrders/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件入库订单列表请求接口
export const searchEntryOrderData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }


  //流程参数处理
  if (data.step == 1) { //申请页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:0"
  }

  if (data.step == 2) { //过磅页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.gte:1,status.lte:3"
  }

  if (data.step == 3) { //检验页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:2"
  }

  if (data.step == 4) { //入库页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:4"
  }

  if (data.step == 5) { //结算页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:5"
  }

  if (data.step == 6) { //汇总页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:6"
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'entryOrders/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个入库订单信息接口
export const getOneEntryOrder = ({ entryOrderId }) => {
  const data = {
    entryOrderId
  }
  console.log("获得传参：", entryOrderId)
  return axios.request({
    url: 'entryOrders/' + entryOrderId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}



//获取品级信息列表接口
export const getTypeList = (data) => {
  console.log("获得品级信息传参：", data)
  //初始化请求参数
  var reqParam = ""
  //按字段查询处理
  if (data != null) {
    if (data.fields != "") {
      reqParam = "?" + "fields=" + data.fields
    }
  }
  //判断上级是否存在
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }
  //读取数量处理
  if (data.offset != "" && data.limit != "") {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + data.offset + "&limit=" + data.limit
  }

  return axios.request({
    url: 'currentPrice/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取品级价格信息列表接口
export const getTypePriceList = (data) => {
  console.log("获得品级历史价格信息传参：", data)
  //初始化请求参数
  var reqParam = ""
  //按字段查询处理
  if (data != null) {
    if (data.fields != "") {
      reqParam = "?" + "fields=" + data.fields
    }
  }
  //判断上级是否存在
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }
  //读取数量处理
  if (data.offset != "" && data.limit != "") {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + data.offset + "&limit=" + data.limit
  }

  //判断上级是否存在
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  // //读取数据处理
  // if (data.query.endDate != "" && data.query.startDate != "" && data.query.typeName != "") {
  //   if(reqParam == ""){
  //     reqParam = "?"
  //   }
  //   reqParam = reqParam + "query=EndDate.gte:" + data.query.endDate + ",StartDate.lte:" + data.query.startDate + ",TypeName.exact:" + data.query.typeName 
  // }

  //读取数据处理
  if (data.query.endDate != "" && data.query.startDate != "") {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "query=EndDate.gte:" + data.query.endDate + ",StartDate.lte:" + data.query.startDate
  }


  return axios.request({
    url: 'hisPrice/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取装箱类型信息列表接口
export const getPackList = (data) => {
  console.log("获得装箱类型信息传参：", data)
  //初始化请求参数
  var reqParam = ""
  //按字段查询处理
  if (data != null) {
    if (data.fields != "") {
      reqParam = "?" + "fields=" + data.fields
    }
  }
  //判断上级是否存在
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }
  //读取数量处理
  if (data.offset != "" && data.limit != "") {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + data.offset + "&limit=" + data.limit
  }

  return axios.request({
    url: 'pack/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//获取入库地点信息列表接口
export const getLandingList = (data) => {
  console.log("获得入库地点信息传参：", data)
  //初始化请求参数
  var reqParam = ""
  //按字段查询处理
  if (data != null) {
    if (data.fields != "") {
      reqParam = "?" + "fields=" + data.fields
    }
  }
  //判断上级是否存在
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }
  //读取数量处理
  if (data.offset != "" && data.limit != "") {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + data.offset + "&limit=" + data.limit
  }

  return axios.request({
    url: 'landing/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

/**************************
 * 出库订单信息接口
 **************************/
//创建出库订单信息接口
export const createDlvOrderData = (data) => {
  console.log("创建出库订单接收数据：", data)
  return axios.request({
    url: 'dlvOrders/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改出库订单信息接口
export const updateDlvOrderData = (data) => {
  console.log("修改出库订单接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'dlvOrders/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页出库订单列表请求接口
export const getAllDlvOrders = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  //流程参数处理
  if (data.step == 1) { //申请页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:0"
  }

  if (data.step == 2) { //出库结算页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:1"
  }

  if (data.step == 3) { //过磅页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.gte:2,status.lte:4"
  }

  if (data.step == 4) { //出库页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:3"
  }

  if (data.step == 5) { //汇总页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:5"
  }

  return axios.request({
    url: 'dlvOrders/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件出库订单列表请求接口
export const searchDlvOrderData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  //流程参数处理
  if (data.step == 1) { //申请页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:0"
  }

  if (data.step == 2) { //出库结算页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:1"
  }

  if (data.step == 3) { //过磅页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.gte:2,status.lte:4"
  }

  if (data.step == 4) { //出库页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:3"
  }

  if (data.step == 5) { //汇总页面
    if (reqParam == "") {
      reqParam = "?"
    } else {
      reqParam = reqParam + "&"
    }
    reqParam = reqParam + "query=" + "status.exact:5"
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'dlvOrders/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个出库订单信息接口
export const getOneDlvOrder = ({ dlvOrderId }) => {
  const data = {
    dlvOrderId
  }
  console.log("获得传参：", dlvOrderId)
  return axios.request({
    url: 'dlvOrders/' + dlvOrderId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


/**************************
 * 卸货地点信息管理接口
 **************************/
//创建卸货地点信息接口
export const createLandingData = (data) => {
  console.log("创建卸货地点接收数据：", data)
  return axios.request({
    url: 'landing/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改卸货地点信息接口
export const updateLandingData = (data) => {
  console.log("修改卸货地点接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'landing/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页卸货地点列表请求接口
export const getAllLandings = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'landing/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件卸货地点列表请求接口
export const searchLandingData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'landing/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个卸货地点信息接口
export const getOneLanding = ({ landingId }) => {
  const data = {
    landingId
  }
  console.log("获得传参：", landingId)
  return axios.request({
    url: 'landing/' + landingId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


/**************************
 * 装箱类型信息管理接口
 **************************/
//创建装箱类型信息接口
export const createPackData = (data) => {
  console.log("创建装箱类型接收数据：", data)
  return axios.request({
    url: 'pack/',
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'post'
  })
}

//修改装箱类型信息接口
export const updatePackData = (data) => {
  console.log("修改装箱类型接收数据：", data)
  //初始化请求参数
  var reqParam = ""
  if (data.Id != null) {
    reqParam = data.Id
  }
  return axios.request({
    url: 'pack/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    data: data,
    method: 'put'
  })
}


//获取分页装箱类型列表请求接口
export const getAllPacks = (data) => {
  console.log("获得列表请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //分页处理参数
  if (data != null) {
    if (data.page > 0 && data.rows > 0) {
      if (reqParam == "") {
        reqParam = "?"
      }
      reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
    }
  }

  return axios.request({
    url: 'pack/' + reqParam,
    //data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}


//按条件装箱类型列表请求接口
export const searchPackData = (data) => {
  console.log("获得查询请求参数", data)
  //初始化请求参数
  var reqParam = ""

  //模糊查询处理
  if (data.searchKy != "" && data.searchVal != "") {
    if (data.searchKy == "Age") {
      reqParam = "?" + "query=" + data.searchKy + ".gte:" + data.searchVal
    } else if (data.searchKy == "Sex") {
      if (data.searchVal == "男") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "0"
      } else if (data.searchVal == "女") {
        reqParam = "?" + "query=" + data.searchKy + ":" + "1"
      }
    } else {
      reqParam = "?" + "query=" + data.searchKy + ".contains:" + data.searchVal
    }

  }
  //判断上级参数是否存在,添加连接符&
  if (reqParam != "") {
    reqParam = reqParam + "&"
  }

  //分页处理参数
  if (data.page > 0 && data.rows > 0) {
    if (reqParam == "") {
      reqParam = "?"
    }
    reqParam = reqParam + "offset=" + ((data.page - 1) * data.rows) + "&limit=" + data.rows
  }

  console.log("请求参数", reqParam)
  //发送请求
  return axios.request({
    url: 'pack/' + reqParam,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}

//获取单个装箱类型信息接口
export const getOnePack = ({ packId }) => {
  const data = {
    packId
  }
  console.log("获得传参：", packId)
  return axios.request({
    url: 'pack/' + packId,
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'get'
  })
}







/**************************
 * 时间戳转换为日期
 **************************/
export const timestampToDate = (timestamp, format) => {
  if (isNaN(timestamp)) {
    return '';
  }

  if (format.length < 4 || 'yyyy-MM-dd'.indexOf(format) !== 0) {
    return '';
  }

  const date = new Date(Number(timestamp));
  const year = date.getFullYear();
  const month = date.getMonth() + 1;
  const day = date.getDate();
  //const hour = date.getHours();
  //const minute = date.getMinutes();
  //const second = date.getSeconds();

  return format.replace('yyyy', year)
    .replace('MM', month > 9 ? month : `0${month}`)
    .replace('dd', day > 9 ? day : `0${day}`)
  //.replace('HH', hour > 9 ? hour :`0${hour}`)
  //.replace('mm', minute > 9 ? minute : `0${minute}`)
  //.replace('ss', second > 9 ? second : `0${second}`);

}

export const diffDate = (startDate, endDate, type) => {
  // 计算时间差
  var diffValue = Math.abs(Number(endDate) - Number(startDate));
  var second = 1000,
    minute = second * 60,
    hour = minute * 60,
    day = hour * 24,
    month = day * 30,
    year = month * 12;
  var timeType = {
    second: second,
    minute: minute,
    hour: hour,
    day: day,
    month: month,
    year: year
  };
  //console.log("价格周期基准值：",timeType[type]);
  return Math.ceil(diffValue / timeType[type]);
}


export const formatLateDate = (date, lateCount) => {
  date.setDate(date.getDate() + lateCount);
  var year = date.getFullYear()
  var month = date.getMonth() + 1
  var day = date.getDate()
  // var hour = date.getHours()
  // var minute = date.getMinutes()
  // var second = date.getSeconds()


  return [year, month, day].map(formatNumber).join('-')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}










//查询分页订单列表请求接口
export const quOrderData = (data) => {
  return axios.request({
    url: 'pageListOrders?sysUserBySysUserId.userId=' + Cookies.get('userId'),
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取分页订单列表请求接口
export const getAuditOrderData = (data) => {
  return axios.request({
    url: 'orders/queryAuditByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取订单详情列表请求接口
export const getAuditOrderDetail = (data) => {
  return axios.request({
    url: 'orders/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}






//获取待指派订单接口
export const getAssignOrder = (data) => {
  return axios.request({
    url: 'orders/queryAssignByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取待指派单个订单接口
export const getAssignDetail = (data) => {
  return axios.request({
    url: 'orderJob/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//用车申请审核方法
export const subAuditOrder = (data) => {
  return axios.request({
    url: 'orders/audit',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//申请用车接口
export const applyCar = (data) => {
  return axios.request({
    url: 'orders/save',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询车辆列表
export const getVehlist = () => {
  return axios.request({
    url: 'vehicleType/query',
    method: 'post'
  })
}
//查询用车属性
export const getPurpose = () => {
  return axios.request({
    url: 'dict/query?superCode=isPurpose',
    method: 'post'
  })
}

//文件下载方法
export const downLoadFile = (data) => {
  return axios.request({
    url: 'file/download',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//调度日志方法
export const getLogData = (data) => {
  return axios.request({
    url: 'businessLog/queryByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询已核算订单分页方法
export const getAuditCostData = (data) => {
  return axios.request({
    url: 'orderJob/queryTaskByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//提交订单结算方法
export const subAuditCostData = (data) => {
  return axios.request({
    url: 'orderJob/settle',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//修改价格方法
export const undateAuditCostData = (data) => {
  return axios.request({
    url: 'orderJob/updateCost',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//退回到待结状态
export const subSettleBack = (data) => {
  return axios.request({
    url: 'orderJob/settleBack',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}








//司机接口 
//获取分页司机接口 
export const getDriverPage = (data) => {
  return axios.request({
    url: 'driver/queryByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}

//调度接口
//订单指派接口
export const subAssignOrder = (data) => {
  return axios.request({
    url: 'orderJob/assign',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//订单取消接口
export const CancelDispatchOrder = (data) => {
  return axios.request({
    url: 'orders/cancel',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//订单平调接口
export const flatDispatchOrder = (data) => {
  return axios.request({
    url: 'orders/flat',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//订单平调车辆分页接口
export const getFlatOrder = (data) => {
  return axios.request({
    url: 'orders/queryFlatByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//提交订单平调审核结果接口
export const subFlatAudit = (data) => {
  return axios.request({
    url: 'orders/flatAudit',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//方案审批订单列表分页接口
export const getAuditOrder = (data) => {
  return axios.request({
    url: 'orderJob/queryAssignAuditByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//方案审批订单详情请求接口
export const getJobDetail = (data) => {
  return axios.request({
    url: 'orderJob/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//方案审批审核结果提交请求接口
export const subDispatchAudit = (data) => {
  return axios.request({
    url: 'orderJob/assignAudit',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//调整方案订单列表分页接口
export const getAdjustOrder = (data) => {
  return axios.request({
    url: 'orderJob/queryTaskByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//提交订单调整方案接口
export const subAdjustOrder = (data) => {
  return axios.request({
    url: 'orderJob/reassign',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//操作单列表分页接口
export const getJobPageOrder = (data) => {
  return axios.request({
    url: 'orderJob/queryDriverTaskByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}


//操作单取消接口
export const CancelJobOrder = (data) => {
  return axios.request({
    url: 'orderJob/cancelJob',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}

//确认操作单
export const ConfirmJobOrder = (data) => {
  return axios.request({
    url: 'orderJob/confirm',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//紧急终止接口
export const StopJobOrder = (data) => {
  return axios.request({
    url: 'orderJob/cancelJob',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//费用审核提交接口
export const subCostOrder = (data) => {
  return axios.request({
    url: 'orderJob/cost',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//历史订单分页获取接口
export const getHistoryOrder = (data) => {
  return axios.request({
    url: 'orders/queryByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//台账获取接口
export const getLedgerOrder = (data) => {
  return axios.request({
    url: 'orderJob/queryFinishTaskByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}










//获取行政区划车辆
export const getRegionlist = (data) => {
  return axios.request({
    url: 'region/query',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取行政区划订单
export const getRegionorder = (data) => {
  return axios.request({
    url: 'orders/countRegionOrderNum',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取用户列表
export const getUserlist = (data) => {
  return axios.request({
    url: 'listSysUser',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取用户分页列表
export const getUserPageData = (data) => {
  return axios.request({
    url: 'user/queryByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取单个用户信息
/*export const getUserData = (data) => {
  return axios.request({
    url: 'user/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}*/
//查询用户名是否重复
export const getRepeatUser = (data) => {
  return axios.request({
    url: 'user/checkUnique',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//增加用户信息
export const addUserData = (data) => {
  return axios.request({
    url: 'user/save',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//修改用户信息
export const UpdateUserData = (data) => {
  return axios.request({
    url: 'user/update',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//删除
export const DeleteUser = (data) => {
  return axios.request({
    url: 'user/delete',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//角色
//查询用户所选权限
export const queryCustomRights = (data) => {
  return axios.request({
    url: 'userUrl/queryMenu',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询用户所选权限数
export const queryCustomTrees = (data) => {
  return axios.request({
    url: 'menu/queryCustomMenuTree',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//保存用户所选权限
export const SaveUserRights = (data) => {
  return axios.request({
    url: 'userUrl/updateMenu',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取资源项
export const getResources = (data) => {
  return axios.request({
    url: 'userUrl/queryByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取单个资源项
export const getResourcesById = (data) => {
  return axios.request({
    url: 'userUrl/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取资源规则列表
export const quResourceRule = (data) => {
  return axios.request({
    url: 'dict/query?superCode=resourceRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//修改资源项配置
export const subResourcesById = (data) => {
  return axios.request({
    url: 'userUrl/update',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}




















//获取部门列表
export const getDeplist = (data) => {
  return axios.request({
    url: 'dept/query',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取角色列表
export const getRoleslist = (data) => {
  return axios.request({
    url: 'role/query',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}

//用车申请提交方法
export const subOrderData = (data) => {
  return axios.request({
    url: 'orders/save',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//订单删除
export const DeleteOrder = (data) => {
  return axios.request({
    url: 'updateSomeMoreOrders',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//地图模糊查询方法
export const mapQuerydata = (data) => {
  return axios.request({
    url: 'http://restapi.amap.com/v3/assistant/inputtips?s=rsv3&key=8c5fb3a478d828cadebfa1ab6ec78b2b&callback=jsonp_798575_&platform=JS&logversion=2.0&sdkversion=1.3&appname=http%3A%2F%2Fyls.yxtdh.cn%2FylsWeb%2Fjsp%2FconfirmOrder.jsp%3FmenuSel%3D1&csid=0482619F-50A5-490D-9358-4AF39F4B13DF',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取角色列表
export const getRolesData = (data) => {
  return axios.request({
    url: 'role/queryByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取角色权限树
export const getRoleRight = (data) => {
  return axios.request({
    url: 'menu/queryMenuTree',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取单个角色信息
export const getRolesDetail = (data) => {
  return axios.request({
    url: 'role/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//修改角色信息
export const updateRoles = (data) => {
  return axios.request({
    url: 'role/update',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//增加角色信息
export const addRoles = (data) => {
  return axios.request({
    url: 'role/save',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询角色列表
export const quRoleData = (data) => {
  return axios.request({
    url: 'pageListSysRole',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//删除角色列表
export const DeleteRole = (data) => {
  return axios.request({
    url: 'role/delete',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取区域单位数列表
export const getRegionUnitData = () => {
  return axios.request({
    url: 'confDept/queryDepat',
    method: 'post'
  })
}
//获取各市单位数列表
export const getRetailUnitData = (data) => {
  return axios.request({
    url: 'confDept/queryCityDepat',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域车辆数列表
export const getRegionCarData = () => {
  return axios.request({
    url: 'vehicle/countRegionVehicleNum',
    method: 'post'
  })
}
//获取区县车辆数列表
export const getDetailCarData = (data) => {
  return axios.request({
    url: 'vehicle/countCountyVehicleNum',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取车辆列表
export const getCarsData = (data) => {
  return axios.request({
    url: 'vehicle/queryByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取车辆列表
export const getCarsNoObd = ({ page, rows }) => {
  const data = {
    page,
    rows
  }
  return axios.request({
    url: 'obd/pageListVehicleBasicNoOfObd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取区域油耗列表
export const getRegionOilData = (data) => {
  return axios.request({
    url: 'oilMis/queryAllOil',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域油耗列表
export const getRegionOilTotal = (data) => {
  return axios.request({
    url: 'oilMis/total',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域油耗列表
export const getRegionCityOilData = (data) => {
  return axios.request({
    url: 'oilMis/queryCityOil',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域车辆预警统计数
export const getRegionSpeedData = (data) => {
  return axios.request({
    url: 'obdAlarm/total',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域车辆预警列表
export const getRegionSpeedList = (data) => {
  return axios.request({
    url: 'obdAlarm/beyond',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域地图数据列表
export const getRegionmapData = (data) => {
  return axios.request({
    url: 'confDept/queryCityAll',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//获取区域单位列表
export const getRegionUnitLists = (data) => {
  return axios.request({
    url: 'confDept/deptList',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}







//车讯车辆
export const quCarsData = (data) => {
  return axios.request({
    url: 'pageListVehicleBasic',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取车辆单个信息
export const getCarsDetail = ({ id }) => {
  const data = {
    id
  }
  return axios.request({
    url: 'vehicle/queryById',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//车辆新增提交方法
export const subVelData = (data) => {
  return axios.request({
    url: 'addVehicleBasic',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//车辆列表更新方法
export const updateVelData = (data) => {
  return axios.request({
    url: 'updateVehicleBasic',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取车辆品牌型号
export const getBrandData = () => {
  return axios.request({
    url: 'vehicleBrand/query',
    method: 'post'
  })
}
//获取驱动类型
export const getPowerType = (x) => {
  return axios.request({
    url: 'dict/query',
    method: 'post',
    params: {
      'superCode': x
    }
  })
}
//获取部门列表
export const getDeptLists = () => {
  return axios.request({
    url: 'dept/query',
    method: 'post',
  })
}
//获取平台列表
export const getModeLists = () => {
  return axios.request({
    url: 'mode/query',
    method: 'post',
  })
}
//获取车队列表
export const getFleetLists = () => {
  return axios.request({
    url: 'vehicleTeam/query',
    method: 'post',
  })
}
//车辆新增接口
export const addVehicleLists = (data) => {
  return axios.request({
    url: 'vehicle/save',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post',
  })
}
//车辆编辑接口
export const updVehicleLists = (data) => {
  return axios.request({
    url: 'vehicle/update',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post',
  })
}
//车辆配备及处置接口
//车辆配备
export const getVehicleEquipLists = (data) => {
  return axios.request({
    url: 'vehSale/queryByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post',
  })
}









//驾驶员
//获取驾驶员列表
export const getDriverLists = () => {
  return axios.request({
    url: 'driver/query',
    method: 'post',
  })
}

//获取驾驶员列表
export const getDriverData = ({ page, rows }) => {
  const data = {
    page,
    rows
  }
  return axios.request({
    url: 'pageListSysUser?userLevel=3',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取公司信息
export const getComData = ({ page, rows }) => {
  const data = {
    page,
    rows
  }
  return axios.request({
    url: 'pageListCompany',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询公司信息
export const quComData = (data) => {
  return axios.request({
    url: 'pageListCompany',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询上级公司列表
// export const getVehlist = () => {
//   return axios.request({
//     url: 'getAboveAndBelowCompany',
//     method: 'post'
//   })
// }
//查询上级公司列表
export const getFatherCompany = () => {
  return axios.request({
    url: 'getAboveAndBelowCompany',
    method: 'post'
  })
}
//获取公司单个信息
export const ComData = ({ companyId }) => {
  const data = {
    companyId
  }
  return axios.request({
    url: 'listCompany',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//公司不分页列表
export const ComDataLists = (data) => {
  return axios.request({
    url: 'listCompany',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//添加 公司信息
export const addComData = (data) => {
  return axios.request({
    url: 'addCompany ',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//修改公司信息
export const updateComData = (data) => {
  return axios.request({
    url: 'updateCompany ',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//删除公司信息
export const DelComdata = (data) => {
  return axios.request({
    url: 'delCompany',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//地图数据加载
export const mapDataList = (data) => {
  return axios.request({
    url: 'http://218.26.228.87:8081/obdLBS/findFirstPosition?ids=c_0',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}


//获取直播地址
export const doGetVideoSrc = (data) => {
  return axios.request({
    url: 'jt808/getSrc',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  });
}


//打开视频监控
export const doOpenVideo = (data) => {
  return axios.request({
    url: 'jt808/openVideo',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  });
}

//打开视频监控
export const doCloseVideo = (data) => {
  return axios.request({
    url: 'jt808/closeVideo',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  });
}

//打开视频监控
export const doPauseVideo = (data) => {
  return axios.request({
    url: 'jt808/pauseVideo',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  });
}


//获取车队列表
export const getDeptTree = (data) => {
  return axios.request({
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    url: 'menu/queryMenuTree',
    method: 'post'
  })
}
//获取车辆数列表
export const getVehicleTree = () => {
  return axios.request({
    url: 'listVehicleTree ',
    method: 'post'
  })
}
//获取车队车辆数
export const getFleetData = (data) => {
  return axios.request({
    url: 'listVehicleBasicIsDept',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取车队为未配车辆数
export const getFleetNotData = () => {
  return axios.request({
    url: 'listVehicleBasicNotDept',
    method: 'post'
  })
}
//移入车队
export const EnterFleet = (data) => {
  return axios.request({
    url: 'updateVehicleBasicToDept',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//移出车队
export const OutFleet = (data) => {
  return axios.request({
    url: 'updateVehicleBasicNotDept',
    method: 'post',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
  })
}
//设备列表  
export const getObdLists = (data) => {
  return axios.request({
    url: 'obd/pageListObd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取单个设备内容详情
export const getObdDetail = (data) => {
  return axios.request({
    url: 'obd/getObdOne',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//设备增加
export const addObdData = (data) => {
  return axios.request({
    url: ' obd/addObd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//设备信息更新
export const updateObdData = (data) => {
  return axios.request({
    url: 'obd/updateAndAddObd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//设备拆除
export const removeObdData = (data) => {
  return axios.request({
    url: ' obd/chaiObd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//设备删除
export const DeleteObd = (data) => {
  return axios.request({
    url: 'obd/delObd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//模板列表接口
export const getWorkflow = (data) => {
  return axios.request({
    url: 'auditTemplate/queryByPageRule',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//用车申请模板提交接口
export const subCarWorkflow = (data) => {
  return axios.request({
    url: 'auditTemplate/save',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//用车申请模板更新接口
export const updCarWorkflow = (data) => {
  return axios.request({
    url: 'auditTemplate/update',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//用车申请模板请求接口
export const qurCarWorkflow = (data) => {
  return axios.request({
    url: 'auditTemplate/queryByDeptAndType',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//用户列表接口
export const getUsersdata = (data) => {
  return axios.request({
    url: 'user/queryByPage',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//用户列表接口
export const resetPassword = (data) => {
  return axios.request({
    url: 'user/resetPasswd',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}


